package com.chinairi.mall.dao;

import com.chinairi.mall.model.ProjectPlanReq;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.chinairi.mall.model.ProjectPlanReqDetail;
import com.chinairi.mall.model.ReqModelDetail;
import com.chinairi.mall.service.modelobject.ProjectPlanReqApproveMO;
import org.apache.ibatis.annotations.Param;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author gsl
 * @since 2020-09-19
 */
public interface ProjectPlanReqMapper extends BaseMapper<ProjectPlanReq> {

    /**
     * 根据模型id查询出模型明细
     * @param modelId
     * @return
     */
    List<ReqModelDetail> selectModelDetail(@Param("modelId") String modelId);

    /**
     * 批量插入需求计划详情
     * @param projectPlanReqDetailList
     */
    void batchInsert(@Param("projectPlanReqDetailList") List<ProjectPlanReqDetail> projectPlanReqDetailList);

    /**
     * 批量更新收货地址和时间
     * @param projectPlanReqDetailList
     */
    void batchUpdateById(@Param("projectPlanReqDetailList") List<ProjectPlanReqDetail> projectPlanReqDetailList);

    /**
     * 项目需求计划判重
     * @param pId
     * @return
     */
    Integer countPId(@Param("pId") String pId);

    /**
     * 获取待审核的数据记录，此时审核状态应为3-审核中，或者除了状态为0的其余所有记录均返回即可。
     * @param projectPlanReqApproveMo
     * @return
     */
    List<ProjectPlanReqApproveMO> getNeedApprove(@Param("search") ProjectPlanReqApproveMO projectPlanReqApproveMo);

    /**
     * 获取需求计划流水号
     * @return
     */
    int getPlanReqNo();
}
